package com.ybkj.o2o.sales.service.impl;

import com.ybkj.o2o.sales.entity.ActivityCouponRule;
import com.ybkj.o2o.sales.mapper.ActivityCouponRuleMapper;
import com.ybkj.o2o.sales.service.ActivityCouponRuleService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
public class DefaultActivityCouponRuleService implements ActivityCouponRuleService {

  @Autowired
  private ActivityCouponRuleMapper activityCouponRuleMapper;
  
  /**
   * 回滚.
   */
  @Transactional(rollbackFor = Exception.class)
  public Long insert(ActivityCouponRule activityCouponRule) {

    return activityCouponRuleMapper.insertRecord(activityCouponRule);

  }

  @Override
  public List<ActivityCouponRule> listByActivity(Long activityId) {

    return activityCouponRuleMapper.selectByActivity(activityId);
  }

  @Override
  public List<ActivityCouponRule> listByCouponRule(Long couponRuleId) {

    return activityCouponRuleMapper.selectByCouponRule(couponRuleId);
  }

}
